package com.kong.rest;

import com.kong.entity.User;
import com.kong.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <dl>
 * <dd>Description: 用户的Controller</dd>
 * <dd>Company: 大诚若谷信息技术有限公司</dd>
 * <dd>@date：2017/6/13 15:53</dd>
 * <dd>@author：Kong</dd>
 * </dl>
 */
@RestController
@RequestMapping("/user")
public class UserRestController {
    /**
     * 测试负载均衡
     */
    private static long callCount = 0;

    @Autowired
    private UserService userService;

    @RequestMapping
    public List<User> search() {
        List<User> users = userService.search();
        System.out.println("我被调用了 " + ++callCount + " 次！");
        return users;
    }
}
